//函数组合示例

function compose (f,g){
  return function(val){
    return f(g(val))
  }
}

function reverse (array) {
  return array.reverse()
}

function first (array) {
  return array[0]
}

const last = compose(first,reverse)

console.log(last([1,2,5,8,9,,7]))